﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:tlk="http://schemas.microsoft.com/wpf/2008/toolkit"
                    xmlns:local="clr-namespace:OMANE.Common.UI.Theme"
    xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">

	<Style x:Key="ThumbStyle" TargetType="{x:Type Thumb}">
		<Setter Property="Cursor" Value="SizeWE"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Margin="0,1,0,1" BorderThickness="1,0,0,0" 
                            BorderBrush="{DynamicResource DegradeBckTitre}" 
                            Background="Transparent" />
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style x:Key="ThumbStyleRight" TargetType="{x:Type Thumb}">
		<Setter Property="Cursor" Value="SizeWE"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Thumb}">
                    <Border BorderThickness="0,0,1,0" 
                            BorderBrush="{DynamicResource BrushCouleur1Base}" 
                            Background="Transparent" />
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
		
    <Style x:Key="DataGridColumnHeaderStyle1" TargetType="{x:Type DataGridColumnHeader}">
        <Setter Property="VerticalContentAlignment" Value="Center"/>
		<Setter Property="Height" Value="24"/>
		<Setter Property="FontWeight" Value="Bold" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
                    <Grid OverridesDefaultStyle="False">
                        <Microsoft_Windows_Themes:DataGridHeaderBorder 
							BorderBrush="{DynamicResource BrushCouleur1Base}" 
							BorderThickness="1,1,1,1" 
							Background="{DynamicResource DegradeBckTitre}" 
							IsClickable="{TemplateBinding CanUserSort}" 
							IsPressed="{TemplateBinding IsPressed}" 
							IsHovered="{TemplateBinding IsMouseOver}" 
							Padding="{TemplateBinding Padding}" 
							SortDirection="{TemplateBinding SortDirection}" 
							SeparatorBrush="Black" 
							SeparatorVisibility="{TemplateBinding SeparatorVisibility}">
                            <ContentPresenter Margin="5,0,5,0"
                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Microsoft_Windows_Themes:DataGridHeaderBorder>
                        <Thumb x:Name="PART_LeftHeaderGripper" HorizontalAlignment="Left" Style="{DynamicResource ThumbStyle}" Background="Transparent" Width="8"/>
						<Thumb x:Name="PART_RightHeaderGripper" HorizontalAlignment="Right" Style="{DynamicResource ThumbStyleRight}" Width="8"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="{ComponentResourceKey ResourceId=DataGridSelectAllButtonStyle, TypeInTargetAssembly={x:Type DataGrid}}" 
           TargetType="{x:Type Button}">
    	<Setter Property="Template">
    		<Setter.Value>
    			<ControlTemplate TargetType="{x:Type Button}">
    				<Grid>
    					<Rectangle x:Name="Border" 
                                   Fill="Transparent" 
                                   SnapsToDevicePixels="True"/>
    				</Grid>
    			</ControlTemplate>
    		</Setter.Value>
    	</Setter>
    </Style>
    
    <Style x:Key="DataGridStyle1" TargetType="{x:Type DataGrid}">
    	<Setter Property="Background" Value="Transparent"/>
    	<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource BrushCouleur1BaseFonce}"/>
    	<Setter Property="BorderThickness" Value="0"/>
    	<Setter Property="RowDetailsVisibilityMode" Value="VisibleWhenSelected"/>
    	<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
    	<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
    	<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
		<Setter Property="VerticalGridLinesBrush" Value="{DynamicResource BrushCouleur1Base}"></Setter>
		<Setter Property="HorizontalGridLinesBrush" Value="{DynamicResource BrushCouleur1Base}"></Setter>
		<Setter Property="FontWeight" Value="Normal" />
    	<Setter Property="Template">
    		<Setter.Value>
    			<ControlTemplate TargetType="{x:Type DataGrid}">
    				<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">
    					<ScrollViewer x:Name="DG_ScrollViewer" Focusable="false">
    						<ScrollViewer.Template>
    							<ControlTemplate TargetType="{x:Type ScrollViewer}">
    								<Grid>
    									<Grid.ColumnDefinitions>
    										<ColumnDefinition Width="Auto"/>
    										<ColumnDefinition Width="*"/>
    										<ColumnDefinition Width="Auto"/>
    									</Grid.ColumnDefinitions>
    									<Grid.RowDefinitions>
    										<RowDefinition Height="Auto"/>
    										<RowDefinition Height="*"/>
    										<RowDefinition Height="Auto"/>
    									</Grid.RowDefinitions>
    									<Button Focusable="false" Style="{DynamicResource {ComponentResourceKey ResourceId=DataGridSelectAllButtonStyle, TypeInTargetAssembly={x:Type DataGrid}}}" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.All}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" Width="{Binding CellsPanelHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}">
    										<Button.Background>
    											<!--<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
    												<GradientStop Color="#FFF3F3F3" Offset="0"/>
    												<GradientStop Color="#FFEBEBEB" Offset="0.5"/>
    												<GradientStop Color="#FFDDDDDD" Offset="0.5"/>
    												<GradientStop Offset="1"/>
    											</LinearGradientBrush>-->
                                                <SolidColorBrush Color="White">
                                                </SolidColorBrush>
    										</Button.Background>
    									</Button>
                                        
    									<DataGridColumnHeadersPresenter x:Name="PART_ColumnHeadersPresenter" Grid.Column="1" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Column}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
    									<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" Grid.ColumnSpan="2" Grid.Row="1"/>
    									<ScrollBar x:Name="PART_VerticalScrollBar" Grid.Column="2" Maximum="{TemplateBinding ScrollableHeight}" Orientation="Vertical" Grid.Row="1" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
    									<Grid Grid.Column="1" Grid.Row="2">
    										<Grid.ColumnDefinitions>
    											<ColumnDefinition Width="{Binding NonFrozenColumnsViewportHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
    											<ColumnDefinition Width="*"/>
    										</Grid.ColumnDefinitions>
    										<ScrollBar x:Name="PART_HorizontalScrollBar" Grid.Column="1" Maximum="{TemplateBinding ScrollableWidth}" Orientation="Horizontal" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
    									</Grid>
    								</Grid>
    							</ControlTemplate>
    						</ScrollViewer.Template>
    						<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
    					</ScrollViewer>
    				</Border>
    			</ControlTemplate>
    		</Setter.Value>
    	</Setter>
    	<Setter Property="HorizontalGridLinesBrush" Value="{DynamicResource BrushCouleur1Base}"/>
    	<Setter Property="IsReadOnly" Value="True"/>
    	<Style.Triggers>
    		<Trigger Property="IsGrouping" Value="true">
    			<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
    		</Trigger>
    	</Style.Triggers>
    </Style>
    <SolidColorBrush x:Key="{x:Static DataGrid.FocusBorderBrushKey}" Color="{DynamicResource Couleur1Base}"/>
    
    <Style x:Key="DataGridCellStyle1" TargetType="{x:Type DataGridCell}">
    	<Setter Property="Background" Value="Transparent"/>
    	<Setter Property="BorderBrush" Value="Transparent"/>
    	<Setter Property="BorderThickness" Value="1"/>
    	<Setter Property="Template">
    		<Setter.Value>
    			<ControlTemplate TargetType="{x:Type DataGridCell}">
    				<Border VerticalAlignment="Center"
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            Background="{TemplateBinding Background}" 
                            SnapsToDevicePixels="True">
    					<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
    				</Border>
    			</ControlTemplate>
    		</Setter.Value>
    	</Setter>
    	<Style.Triggers>
    		<Trigger Property="IsSelected" Value="True">
    			<Setter Property="Background" Value="{DynamicResource DegradeDefaultSelected}"/>
    			<Setter Property="Foreground" Value="Black"/>
    			<Setter Property="BorderBrush" Value="{DynamicResource DegradeDefaultSelected}"/>
    		</Trigger>
    		<Trigger Property="IsKeyboardFocusWithin" Value="True">
    			<Setter Property="BorderBrush" Value="{DynamicResource {x:Static DataGrid.FocusBorderBrushKey}}"/>
    		</Trigger>
    	</Style.Triggers>
    </Style>
    
    <ItemsPanelTemplate x:Key="ItemsPanelTemplate1">
    	<DataGridRowsPresenter x:Name="PART_RowsPresenter" IsItemsHost="True"/>
    </ItemsPanelTemplate>
    <BooleanToVisibilityConverter x:Key="bool2VisibilityConverter"/>
    <Style x:Key="RowHeaderGripperStyle" TargetType="{x:Type Thumb}">
    	<Setter Property="Height" Value="8"/>
    	<Setter Property="Background" Value="Transparent"/>
    	<Setter Property="Cursor" Value="SizeNS"/>
    	<Setter Property="Template">
    		<Setter.Value>
    			<ControlTemplate TargetType="{x:Type Thumb}">
    				<Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"/>
    			</ControlTemplate>
    		</Setter.Value>
    	</Setter>
    </Style>
    
    <Style x:Key="DataGridRowHeaderStyle1" TargetType="{x:Type DataGridRowHeader}">
    	<Setter Property="Template">
    		<Setter.Value>
    			<ControlTemplate TargetType="{x:Type DataGridRowHeader}">
    				<Grid>
    					<Microsoft_Windows_Themes:DataGridHeaderBorder BorderBrush="{DynamicResource BrushCouleur1Base}" Background="{DynamicResource DegradeBckTitre}" IsPressed="{TemplateBinding IsPressed}" IsHovered="{TemplateBinding IsMouseOver}" IsSelected="{TemplateBinding IsRowSelected}" Orientation="Horizontal" Padding="{TemplateBinding Padding}" SeparatorBrush="{TemplateBinding SeparatorBrush}" SeparatorVisibility="{TemplateBinding SeparatorVisibility}" BorderThickness="1">
    						<StackPanel Orientation="Horizontal">
    							<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                                  VerticalAlignment="Center" 
                                                  Margin="5,0"/>
    							<Control SnapsToDevicePixels="false" 
                                         Template="{Binding ValidationErrorTemplate, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}" 
                                         Visibility="{Binding (Validation.HasError), Converter={StaticResource bool2VisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}"/>
    						</StackPanel>
    					</Microsoft_Windows_Themes:DataGridHeaderBorder>
    					<Thumb x:Name="PART_TopHeaderGripper" Style="{StaticResource RowHeaderGripperStyle}" VerticalAlignment="Top"/>
    					<Thumb x:Name="PART_BottomHeaderGripper" Style="{StaticResource RowHeaderGripperStyle}" VerticalAlignment="Bottom"/>
    				</Grid>
    			</ControlTemplate>
    		</Setter.Value>
    	</Setter>
    </Style>

    <!--<Style x:Key="HeaderStyle" TargetType="{x:Type tlk:DataGridColumnHeader}" BasedOn="{StaticResource controlOMANE}">
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="Background" Value="{StaticResource DegradeBckBtn}" />
        <Setter Property="BorderThickness" Value="0,0,1,1" />
        <Setter Property="BorderBrush" Value="{StaticResource BrushCouleur1Base}" />
    </Style>

    <Pen x:Key="OMANE_HorizontalGridLinePen">
        <Pen.DashStyle>
            <DashStyle Dashes="2.8" />
        </Pen.DashStyle>
    </Pen>
    
    <Style x:Key="OMANE_DataGridStyle" TargetType="{x:Type tlk:DataGrid}">
        <Setter Property="AutoGenerateColumns" Value="False" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="ColumnHeaderStyle" Value="{StaticResource HeaderStyle}" />
        <Setter Property="HorizontalGridLinesBrush" Value="{StaticResource BrushCouleur1Base}" />
        <Setter Property="VerticalGridLinesBrush" Value="{StaticResource BrushCouleur1Base}" />
    </Style>-->
    <DataTemplate x:Key="TrancheAgeEditTemplate">
        <Border>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <TextBlock Text="{Binding}"/>
                <RepeatButton Grid.Column="1" Content="+" CommandParameter="inc" >
                    <RepeatButton.Command>
                        <local:IncDecCommand TargetValue="{Binding}" />
                    </RepeatButton.Command>
                </RepeatButton>
                <RepeatButton Grid.Column="2" Content="-" CommandParameter="dec">
                    <RepeatButton.Command>
                        <local:IncDecCommand TargetValue="{Binding}" />
                    </RepeatButton.Command>
                </RepeatButton>
            </Grid>
        </Border>
    </DataTemplate>
</ResourceDictionary>
